package cn.itcast.source;

import org.apache.flink.api.common.RuntimeExecutionMode;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.Arrays;

/**
 * @author KTL
 * @version V1.0
 * @Package cn.itcast.source
 * @date 2021/2/23 0023 11:00
 * @Copyright © 2015-04-29  One for each, and two for each
 *  演示：DataStream-Source 基于本地/HDFS的文件/文件夹/压缩文件
 */
public class SourceDemo02_File {
    public static void main(String[] args) throws Exception {
        //TODO 1、source
         StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
         env.setRuntimeMode(RuntimeExecutionMode.AUTOMATIC);
        final DataStreamSource<String> df1 = env.readTextFile("data/words.txt");
        final DataStreamSource<String> df2 = env.readTextFile("data/dir");
        final DataStreamSource<String> df3 = env.readTextFile("data/wordcount.txt.gz");
        //TODO 2、transformation
        //TODO 3、sink
        df1.print();
        df2.print();
        df3.print();
        //TODO 4、execute
        env.execute();
    }

}
